import { defineStore } from 'pinia'
import { listConfig } from "@/api/system/config";

export const useConfigStore = defineStore({
  id: 'config',

  state: () => ({
    configList: []
  }),

  actions: {
    getConfigList() {
      return new Promise((resolve, reject) => {
        let params = {
          pageNum: 1,
          pageSize: 999
        }
        listConfig(params).then(res => {
          this.configList = res.rows

          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
  }
})

export default useConfigStore
